package p270jp.pxv.android.viewholder;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.webkit.URLUtil;
import android.widget.ImageView;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import p216hn.DefaultConstructorMarker;
import p270jp.pxv.android.R;
import p270jp.pxv.android.model.pixiv_sketch.LiveWebSocketMessage;
import p274k2.ContextCompat;
import p314lg.ViewHolderRenewalLivePerformerChatBinding;
import p325m0.MutabilityOwnership;
import p371nj.LiveChatState;
import p677zi.PixivImageLoader;

/* compiled from: RenewalLivePerformerChatViewHolder.kt */
/* renamed from: jp.pxv.android.viewholder.RenewalLivePerformerChatViewHolder */
/* loaded from: classes2.dex */
public final class RenewalLivePerformerChatViewHolder extends RecyclerView.AbstractC0819y {
    private final ViewHolderRenewalLivePerformerChatBinding binding;
    private final PixivImageLoader pixivImageLoader;
    public static final Companion Companion = new Companion(null);
    public static final int $stable = 8;

    /* compiled from: RenewalLivePerformerChatViewHolder.kt */
    /* renamed from: jp.pxv.android.viewholder.RenewalLivePerformerChatViewHolder$Companion */
    /* loaded from: classes2.dex */
    public static final class Companion {
        private Companion() {
        }

        public /* synthetic */ Companion(DefaultConstructorMarker eVar) {
            this();
        }

        public final RenewalLivePerformerChatViewHolder createViewHolder(ViewGroup viewGroup, PixivImageLoader aVar) {
            MutabilityOwnership.m3745m(viewGroup, "parent");
            MutabilityOwnership.m3745m(aVar, "pixivImageLoader");
            ViewHolderRenewalLivePerformerChatBinding u8Var = (ViewHolderRenewalLivePerformerChatBinding) DataBindingUtil.m11370c(LayoutInflater.from(viewGroup.getContext()), R.layout.view_holder_renewal_live_performer_chat, viewGroup, false);
            MutabilityOwnership.m3746l(u8Var, "binding");
            return new RenewalLivePerformerChatViewHolder(u8Var, aVar, null);
        }
    }

    private RenewalLivePerformerChatViewHolder(ViewHolderRenewalLivePerformerChatBinding u8Var, PixivImageLoader aVar) {
        super(u8Var.f2666e);
        this.binding = u8Var;
        this.pixivImageLoader = aVar;
    }

    public /* synthetic */ RenewalLivePerformerChatViewHolder(ViewHolderRenewalLivePerformerChatBinding u8Var, PixivImageLoader aVar, DefaultConstructorMarker eVar) {
        this(u8Var, aVar);
    }

    public final void display(LiveChatState.C5362f fVar) {
        MutabilityOwnership.m3745m(fVar, LiveWebSocketMessage.TYPE_CHAT);
        Context context = this.binding.f2666e.getContext();
        Object obj = ContextCompat.f19963a;
        Drawable b = ContextCompat.C4472c.m4259b(context, R.drawable.bg_live_chat);
        MutabilityOwnership.m3747j(b);
        b.mutate().setTint(fVar.f23894d);
        this.binding.f22318q.setBackground(b);
        this.binding.mo3771z(fVar);
        this.binding.m11392i();
        ImageView imageView = this.binding.f22319r;
        MutabilityOwnership.m3746l(imageView, "binding.iconImageView");
        String str = fVar.f23892b.icon.photoMap.sq60.url;
        if (str == null || (!URLUtil.isHttpsUrl(str) && !URLUtil.isHttpUrl(str))) {
            imageView.setImageDrawable(null);
            return;
        }
        PixivImageLoader aVar = this.pixivImageLoader;
        Context context2 = imageView.getContext();
        MutabilityOwnership.m3746l(context2, "iconImageView.context");
        aVar.m60f(context2, str, imageView);
    }
}
